package com.neusoft.dibuy.tyut.net.server;

import com.neusoft.dibuy.tyut.net.cfg.NetConfig;
import com.neusoft.dibuy.tyut.net.util.File2NetTool;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Demo3App {

    /**
     * TODO : ServerSocket 将一直保持监听
     * @param args
     * @throws IOException
     */

    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(NetConfig.MSG_PORT);
        while (NetConfig.RUNNING) {
            Socket socket = serverSocket.accept();
            InputStream is =  socket.getInputStream();
            String filePath = "D:\\"+ System.currentTimeMillis() +".tgz";
            new File2NetTool(socket ,filePath).start();
        }
    }
}

